<template>
  <div class="main-container">
    <div class="main-container-block">
      <el-form :model="formData" label-width="120px" ref="loginForm" :rules="rules">
        <el-form-item label="用户名：" prop="name">
          <el-input v-model="formData.name" placeholder="请输入用户名" style="width: 200px;"/>
        </el-form-item>
        <el-form-item label="密码：" prop="password">
          <el-input v-model="formData.password" type="password" placeholder="请输入密码" style="width: 200px;"/>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleLogin" :loading="loading">登入</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Login',
  data () {
    return {
      formData: {
        name: 'test',
        password: '123456'
      },
      loading: false,
      rules: {
        name: [
          { required: true, trigger: 'blur', message: '请输入用户名' }
        ],
        password: [
          { required: true, trigger: 'blur', message: '请输入密码' }
        ]
      }
    }
  },
  methods: {
    handleLogin () {
      this.$router.push({ path: '/' })
    }
  }
}
</script>
<style scope>
.main-container-block{
  position: absolute;
  top: 50%;
  left: 50%;
  background: #dddd;
  width: 25%;
  height: 250px;
}
.main-container-block{
  padding: 40px 35px;
  box-sizing: border-box;
}
</style>
